﻿@{
	PageTitle title = ViewData.GetPageTitle();

	string h1Value = null;
	if (title != null && title.Count > 0)
	{
		h1Value = title.Last().Text;
	}
	
	string headText = Html.Head(title).ToString();
	if (!String.IsNullOrEmpty(headText))
	{
		headText += " :: ";
	}

	string userAgent = Context.Request.UserAgent.ToLower();
	bool isMobile = userAgent.Contains("iphone") |
						userAgent.Contains("ppc") |
						userAgent.Contains("windows ce") |
						userAgent.Contains("blackberry") |
						userAgent.Contains("opera mini") |
						userAgent.Contains("mobile") |
						userAgent.Contains("palm") |
						userAgent.Contains("portable");
}
<!DOCTYPE html>
<html>
<head>
	<title>
		@if (IsSectionDefined("headTitle"))
		{
			@RenderSection("headTitle")<text> :: </text>
		}
		else
		{
			@headText.AsHtml()
		}
		Компания &laquo;Майндфор&raquo;
	</title>
	@Html.Partial("Head")
	@RenderSection("head", false)
	@Html.Partial("GoogleAnalytics")
</head>
<body>
	<div id="All">
		@Html.Action("ManageToolbar", "System")
		<header>
			<div>
				<div id="LogoDiv">
					<a href="/" title="Перейти на главную"><img alt="Логотип" src="/Content/Images/Logo.png?v=1" /></a>
					<div id="Phone">Наш телефон:
						@if (isMobile)
						 {
							<a class="big" href="tel:(7 3452) 942509">+7 (3452) 94-25-09</a><br />
						 }
						 else
						 {
							 <span class="small">+7 (3452)</span> <span class="big">94-25-09</span><br />
						 }
						 <a href="mailto:manager@mindfor.ru">manager@mindfor.ru</a>
					 </div>
					@Html.Partial("UserFast")
				</div>
				<nav id="Menu">
					@Html.Action("MainMenu", "Global")
				</nav>
			</div>
			@if (IsSectionDefined("subMenu"))
			{
				@RenderSection("subMenu", false)
			}
			else
			{
				IPage root = CurrentPage.GetRootPage();
				if (root != null && root.ChildPages.Where(p => p.HasAccess(User, false) && p.ShowInMenu).Count() > 0)
				{
					<nav id="SubMenu">
						@Html.Action("SubMenu", "Global")
					</nav>
				}
			}	
		</header>

		@if (IsSectionDefined("replaceMain"))
		{
			@RenderSection("replaceMain")
		}
		else
		{
			<div id="MainSectionWrap">
				<section id="Main">
					@if (IsSectionDefined("title"))
					{
						@RenderSection("title")
					}
					else if (!String.IsNullOrEmpty(h1Value))
					{
						<h1@(title.Count > 1 ? " class='path'".AsHtml() : null)>@h1Value.AsHtml()</h1>
						if (title.Count > 1)
						{
							<nav id="Path">
								@for (int i=0; i<title.Count-1; i++)
								{
									if (i > 0) {
										<span class="arrow">→</span>
									}
									@Html.TitleNode(title[i])
								}
							</nav>
						}
					}
					@RenderBody()
				</section>
			</div>
		}
		<div id="PreFooter"></div>
	</div>
	@Html.Partial("Footer")
</body>
</html>